<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">
    <body>
        <ui:composition template="../templates/default3.xhtml">        
            <ui:define name="content">
                <h:form id="updateSalesOrder" binding="#{salesOrderManagerBean.loadUpdateSalesorder}">
                    <p:panel header="Sales Order information" id="updateSalesOrder1">
                        <table>
                            <tr>
                                <td width ="180px">Company:</td>
                                <td width="200px"> <b><h:outputText id ="company" value="#{salesOrderManagerBean.selectedPurchaseOrder.customer.company}"  />  </b>
                                </td>
                                <td></td><td></td>
                            </tr>
                            <tr>
                                <td>Company Address:</td>
                                <td><h:outputText id ="address" value="#{salesOrderManagerBean.selectedPurchaseOrder.customer.companyAddress.street}, 
                                                  #{salesOrderManagerBean.selectedPurchaseOrder.customer.companyAddress.country}, #{salesOrderManagerBean.selectedPurchaseOrder.customer.companyAddress.postal}             " /> </td>

                                <td></td><td></td>
                            </tr>
                            <tr>
                                <td>Purchase Order No.:</td>
                                <td><h:outputText id="poNumber" value="#{salesOrderManagerBean.selectedPurchaseOrder.poNumber}" />

                                </td>

                            </tr>
                            <tr>
                                <td>Purchase Order Date:</td>
                                <td><h:outputText id="poDate" value="#{salesOrderManagerBean.selectedPurchaseOrder.poDate}" />
                                </td>
                                <td></td><td></td>
                            </tr>

                        </table>

                    </p:panel>


                    <p:panel header="Available Shipping Date" id="updateSalesOrder2">


                        <p:dataTable id="purchaseOrder" var="purchaseItem" value="#{salesOrderManagerBean.selectedPurchaseOrder.purchaseItems}" >

                            <p:column headerText="Product name"> 
                                <h:outputText value="#{purchaseItem.product.name}" />                                             
                            </p:column> 
                            <p:column headerText="Quantity"> 
                                <h:outputText value="#{purchaseItem.quantity}" />                                             
                            </p:column> 

                            <p:column headerText="Request date"> 
                                <h:outputText value="#{purchaseItem.requestDate}" />                                             
                            </p:column>  

                        </p:dataTable>

                        <br/>
                        <br/>
                        <br/>
                        <hr/>
                        <center>
                            <p:commandButton value="Agree" actionListener="#{salesOrderManagerBean.resolve}" ajax="true"/>
                          
                        </center>
                    </p:panel>


                </h:form>
            </ui:define>        
        </ui:composition>
    </body>
</html>
